package ControllerLayer;
import ContainerLayer.*;
import java.util.ArrayList;


/**
 * Write a description of class ProductController here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class ProductController
{
    // instance variables - replace the example below with your own
    private ProductContainer pCon;
    private static ProductController instance; 
    private long id;
    

    /**
     * Constructor for objects of class ProductController
     */
    private ProductController()
    {
        // initialise instance variables
        this.id = 0;
        pCon = ProductContainer.getInstance();
    }
    
    public long getID()
    {
        return id;
    }
    
    public int getPdSize()
    {
        return pCon.getProductDescriptionSize();
    }
    
    public long getPdMinimum(long id)
    {
        return pCon.getProductDescriptionMinimum(id);
    }
    
    public int getPnSize(long id)
    {
        return pCon.getProductNoSize(id);
    }
    
    public long getStoreNo()
    {
        return pCon.getStoreNo();
    }

    public static ProductController getInstance()
    {
        if(instance == null)
        {
            instance = new ProductController();
        }
        return instance;
    }    
    
    public void createProduct(String description, double price, int minNo)
    {
        id++;
        ProductDescription pd = new ProductDescription(id, description, price, minNo); 
        pCon.addProductDescription(pd);
    }
    
    public ProductDescription readProduct(long id)
    {
        return pCon.readProductDescription(id);
    }
    
    public void updateProduct(long id, String description, double price, int minNo)
    {
        pCon.updateProductDescription(id, description, price, minNo);
    }
    
    public void deleteProduct(long id)
    {
        pCon.deleteProductDescription(id);
    }
    
    public void printOneProduct(long id)
    {
        pCon.printOneProductDescription(id);
    }
    
    public void printAllProduc()
    {
        pCon.printAllProductDescription();
    }
    
    public void createProductNo(long id, boolean storeStatus)
    {
        pCon.createProductNoToProductDescription(id, storeStatus);
        
    }
    
    public ProductNo readProductNo(long id, long storeNo)
    {
        return pCon.readProductNoToProductionDescription(id, storeNo);
    }
    
    public void updateProductNo(long id, long storeNo, boolean storeStatus)
    {
        pCon.updateProductNoToProductDescription(id, storeNo, storeStatus);
    }
    
    public void deleteProductNo(long id, long storeNo)
    {
        pCon.deleteProductNoToProductDescription(id, storeNo);
    }
    
    public void printOneProductNo(long id, long storeNo)
    {
        pCon.printOneProductNoToProductDescription(id, storeNo);
    }
    
    public void printAllProductNo(long id)
    {
        pCon.printAllProductNoToProductDescription(id);
    }
}

